package com.boruan.qq.zxgylibrary.utils;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.webkit.JavascriptInterface;

import com.boruan.qq.zxgylibrary.ui.activities.DrugPageDetailActivity;
import com.boruan.qq.zxgylibrary.ui.activities.OrderDetailActivity;
import com.boruan.qq.zxgylibrary.ui.activities.PayCheckStandActivity;
import com.boruan.qq.zxgylibrary.ui.activities.PharmacyHomePageActivity;

/**
 * Created by 崔琦 on 2019/8/2.
 * des: ....
 */

public class DecoObject {

    private Activity mContext;

    public DecoObject(Activity mContext) {
        this.mContext = mContext;
    }

    @JavascriptInterface
    public void clickBack(){
        //Toast.makeText(mContext, "我要返回上一页！", Toast.LENGTH_SHORT).show();
        mContext.finish();
    }

    @JavascriptInterface
    public void clickEnterPharmacy(String id){//点击进入药店详情
        Log.i("id",id + "lala");
        Intent intent = new Intent(mContext, PharmacyHomePageActivity.class);
        intent.putExtra("id",id);
        mContext.startActivity(intent);
    }

    @JavascriptInterface
    public void clickEnterDrugDetail(String id){
        Log.i("id",id + "detail");
        Intent intent = new Intent(mContext, DrugPageDetailActivity.class);
        intent.putExtra("id",id);
        mContext.startActivity(intent);
    }

    @JavascriptInterface
    public void goToPay(String id,String shopName,String money){
        //用户从订单里面去支付
        Intent intent = new Intent(mContext,PayCheckStandActivity.class);
        intent.putExtra("orderId",id);
        intent.putExtra("money",money);
        intent.putExtra("shopName",shopName);
        mContext.startActivity(intent);
    }

    @JavascriptInterface
    public void clickEnterOrderDetail(String orderStatus,String orderId){
        Log.i("id","啦啦啦");
        //用户从订单列表里面点击进入订单详情
        Intent intent = new Intent(mContext,OrderDetailActivity.class);
        intent.putExtra("orderStatus",orderStatus);
        intent.putExtra("orderId",orderId);
        mContext.startActivity(intent);
    }
}
